import heapq


class PriorityQueue:
    def __init__(self):
        self.queue = []
        self.index = 0

    def push(self, item, protity):
        heapq.heappush(self.queue, (-protity, self.index, item))
        self.index += 1

    def pop(self):
        return heapq.heappop(self.queue)[-1]


heapq.heappush()

# 优先队列
h = []
heapq.heappush(h, (-3, {'name': '张三', 'age': 13}))
heapq.heappush(h, (-4, {'name': '李四', 'age': 13}))
heapq.heappush(h, (-6, {'name': '王五', 'age': 13}))
heapq.heappush(h, (-2, {'name': '赵六', 'age': 13}))
print(h)
# 第一个pop()返回优先级最高的元素
print(heapq.heappop(h))
print(heapq.heappop(h))
print(heapq.heappop(h))
print(heapq.heappop(h))
print(h)
